package com.sg.service.biz.bff.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.sg.common.util.CommonFunctionHelper;
import com.sg.common.util.RedisUtil;
import com.sg.dto.biz.bff.req.*;
import com.sg.dto.biz.bff.res.*;
import com.sg.dto.integration.component.GenerateDataObjectBatchCodeComReqDto;
import com.sg.dto.integration.component.GenerateDataObjectBatchCodeComRespDto;
import com.sg.dto.integration.framework.BatchQueryDeptComReqDto;
import com.sg.dto.integration.framework.BatchQueryDeptComRespDto;
import com.sg.dto.integration.framework.DeptDto;
import com.sg.service.biz.bff.EvaCalcService;
import com.wicket.okrapp.integration.EvaCalcService;
import com.wicket.okrapp.integration.dto.*;
import com.wicket.okrbff.common.dto.TreeNode;
import com.sg.common.exception.Assert;
import com.wicket.okrcomponent.integration.InterfaceModeService;
import com.wicket.okrframework.integration.OrgService;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Service
public class EvaCalcServiceImpl implements EvaCalcService {

    @Resource
    private RedisUtil redisUtil;
    @Resource
    com.sg.service.biz.app.EvaCalcService fwAppEvaCalcClient;
    @Resource
    com.sg.service.biz.component.InterfaceModeService fwCompInterfaceModeClient;
    @Resource
    com.sg.service.biz.framework.OrgService fwBaseOrgClient;

    /**
     * B3执行修正进度值/实际值/费用等[9865]
     * gen by moon at 9/26/2024, 6:51:39 PM
     */
    @Trace(operationName = "B3执行修正进度值/实际值/费用等")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffImplementAdjustedProgressActualCostAmountEtcRespDto implementAdjustedProgressActualCostAmountEtc(BffImplementAdjustedProgressActualCostAmountEtcReqDto reqDto) {


        ImplementAdjustedProgressActualCostAmountEtcRespDto implementAdjustedProgressActualCostAmountEtcRespDto_1 = null;
        //步骤0: D3执行修正进度值/实际值/费用等 - implementAdjustedProgressActualCostAmountEtc
        ImplementAdjustedProgressActualCostAmountEtcRespDto implementAdjustedProgressActualCostAmountEtcRespDto = null;
        ImplementAdjustedProgressActualCostAmountEtcReqDto implementAdjustedProgressActualCostAmountEtcReqDto = new ImplementAdjustedProgressActualCostAmountEtcReqDto();
        implementAdjustedProgressActualCostAmountEtcReqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:1891786_1
        if (reqDto != null) {
            implementAdjustedProgressActualCostAmountEtcReqDto.setTaskId(reqDto.getTaskId());//SimpleFieldAssign//sourceId:1891788_1
            implementAdjustedProgressActualCostAmountEtcReqDto.setProgressValue(reqDto.getProgressValue());//SimpleFieldAssign//sourceId:1891777_1
            implementAdjustedProgressActualCostAmountEtcReqDto.setActualValue(reqDto.getActualValue());//SimpleFieldAssign//sourceId:1891778_1
            implementAdjustedProgressActualCostAmountEtcReqDto.setDataResultId(reqDto.getDataResultId());//SimpleFieldAssign//sourceId:1891779_1
            implementAdjustedProgressActualCostAmountEtcReqDto.setBudgetDisburse(reqDto.getBudgetDisburse());//SimpleFieldAssign//sourceId:1891780_1
            implementAdjustedProgressActualCostAmountEtcReqDto.setAccountSubjectld(reqDto.getAccountSubjectld());//SimpleFieldAssign//sourceId:1891781_1
            implementAdjustedProgressActualCostAmountEtcReqDto.setCycleId(reqDto.getCycleId());//SimpleFieldAssign//sourceId:1891782_1
            implementAdjustedProgressActualCostAmountEtcReqDto.setCycleTypeCode(reqDto.getCycleTypeCode());//SimpleFieldAssign//sourceId:1891783_1
            implementAdjustedProgressActualCostAmountEtcReqDto.setEvaObjTargetCycleId(reqDto.getEvaObjTargetCycleId());//SimpleFieldAssign//sourceId:1891787_1
            implementAdjustedProgressActualCostAmountEtcReqDto.setTargetCycleContentId(reqDto.getTargetCycleContentId());//SimpleFieldAssign//sourceId:1891784_1
            implementAdjustedProgressActualCostAmountEtcReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:1891785_1
        }

        /*D3执行修正进度值/实际值/费用等[9864]   */
        Assert.isNull(implementAdjustedProgressActualCostAmountEtcReqDto.getTaskId(), "B3执行修正进度值/实际值/费用等-D3执行修正进度值/实际值/费用等-任务ID不能为空", false);
        Assert.isNull(implementAdjustedProgressActualCostAmountEtcReqDto.getCycleId(), "B3执行修正进度值/实际值/费用等-D3执行修正进度值/实际值/费用等-归属周期ID不能为空", false);
        Assert.isNull(implementAdjustedProgressActualCostAmountEtcReqDto.getCycleTypeCode(), "B3执行修正进度值/实际值/费用等-D3执行修正进度值/实际值/费用等-周期类型标识不能为空", false);
        Assert.isNull(implementAdjustedProgressActualCostAmountEtcReqDto.getEvaObjTargetCycleId(), "B3执行修正进度值/实际值/费用等-D3执行修正进度值/实际值/费用等-被评对象目标周期ID不能为空", false);
        Assert.isNull(implementAdjustedProgressActualCostAmountEtcReqDto.getTargetCycleContentId(), "B3执行修正进度值/实际值/费用等-D3执行修正进度值/实际值/费用等-关联目标内容ID不能为空", false);
        Assert.isNull(implementAdjustedProgressActualCostAmountEtcReqDto.getEvaluationTemplateId(), "B3执行修正进度值/实际值/费用等-D3执行修正进度值/实际值/费用等-冗余评价模板ID不能为空", false);
        Assert.isNull(implementAdjustedProgressActualCostAmountEtcReqDto.getSpaceId(), "B3执行修正进度值/实际值/费用等-D3执行修正进度值/实际值/费用等-创建于空间ID不能为空", false);
        implementAdjustedProgressActualCostAmountEtcRespDto = fwAppEvaCalcClient.implementAdjustedProgressActualCostAmountEtc(implementAdjustedProgressActualCostAmountEtcReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        implementAdjustedProgressActualCostAmountEtcRespDto_1 = implementAdjustedProgressActualCostAmountEtcRespDto;

        BffImplementAdjustedProgressActualCostAmountEtcRespDto retData = new BffImplementAdjustedProgressActualCostAmountEtcRespDto();
        if (implementAdjustedProgressActualCostAmountEtcRespDto_1 != null) {
            retData.setApproveCalcScene(implementAdjustedProgressActualCostAmountEtcRespDto_1.getApproveCalcScene());//SimpleFieldAssign//sourceId:2011235_1
            retData.setCycleStartTime(implementAdjustedProgressActualCostAmountEtcRespDto_1.getCycleStartTime());//SimpleFieldAssign//sourceId:2011236_1
        }


        return retData;
    }

    /**
     * B3执行分段更新目标标准数据(管理)[9940]
     * gen by moon at 7/5/2024, 11:49:28 PM
     */
    @Trace(operationName = "B3执行分段更新目标标准数据(管理)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffImplementSegUpdateTargetStandardDataRespDto implementSegUpdateTargetStandardData(BffImplementSegUpdateTargetStandardDataReqDto reqDto) {


        //步骤0: D2生成数据对象批次标识(公共) - generateDataObjectBatchCodeCom
        GenerateDataObjectBatchCodeComRespDto generateDataObjectBatchCodeComRespDto = null;
        GenerateDataObjectBatchCodeComReqDto generateDataObjectBatchCodeComReqDto = new GenerateDataObjectBatchCodeComReqDto();


        /*D2生成数据对象批次标识(公共)[9404]   */

        generateDataObjectBatchCodeComRespDto = fwCompInterfaceModeClient.generateDataObjectBatchCodeCom(generateDataObjectBatchCodeComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


//步骤1: D3执行分段更新目标标准数据(公共) - implementSegUpdateTargetStandardDataCom
        ImplementSegUpdateTargetStandardDataComRespDto implementSegUpdateTargetStandardDataComRespDto = null;
        if (generateDataObjectBatchCodeComRespDto != null) {
            ImplementSegUpdateTargetStandardDataComReqDto implementSegUpdateTargetStandardDataComReqDto = new ImplementSegUpdateTargetStandardDataComReqDto();
            implementSegUpdateTargetStandardDataComReqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:1922298_1
            if (reqDto != null) {
                implementSegUpdateTargetStandardDataComReqDto.setDataUsageSceneCode(reqDto.getDataUsageSceneCode());//SimpleFieldAssign//sourceId:1922299_1
                implementSegUpdateTargetStandardDataComReqDto.setDatasNum(reqDto.getDatasNum());//SimpleFieldAssign//sourceId:1922294_1
                implementSegUpdateTargetStandardDataComReqDto.setEvaObjEntityId(reqDto.getEvaObjEntityId());//SimpleFieldAssign//sourceId:1922295_1
                implementSegUpdateTargetStandardDataComReqDto.setEvaObjTypeCode(reqDto.getEvaObjTypeCode());//SimpleFieldAssign//sourceId:1922296_1
                implementSegUpdateTargetStandardDataComReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:1922297_1
            }
            if (generateDataObjectBatchCodeComRespDto != null) {
                implementSegUpdateTargetStandardDataComReqDto.setDataObjectBatchCode(generateDataObjectBatchCodeComRespDto.getDataObjectBatchCode());//SimpleFieldAssign//sourceId:1922293_1
            }

            /*D3执行分段更新目标标准数据(公共)[9939]   */
            Assert.isNull(implementSegUpdateTargetStandardDataComReqDto.getDataUsageSceneCode(), "B3执行分段更新目标标准数据(管理)-D3执行分段更新目标标准数据(公共)-数据业务场景不能为空", false);
            Assert.isNull(implementSegUpdateTargetStandardDataComReqDto.getDataObjectBatchCode(), "B3执行分段更新目标标准数据(管理)-D3执行分段更新目标标准数据(公共)-数据对象批次标识不能为空", false);
            Assert.isNull(implementSegUpdateTargetStandardDataComReqDto.getDatasNum(), "B3执行分段更新目标标准数据(管理)-D3执行分段更新目标标准数据(公共)-数据条数不能为空", false);
            Assert.isNull(implementSegUpdateTargetStandardDataComReqDto.getEvaObjEntityId(), "B3执行分段更新目标标准数据(管理)-D3执行分段更新目标标准数据(公共)-主树被评对象内容表主键ID不能为空", false);
            Assert.isNull(implementSegUpdateTargetStandardDataComReqDto.getEvaObjTypeCode(), "B3执行分段更新目标标准数据(管理)-D3执行分段更新目标标准数据(公共)-主树被评对象类型编码不能为空", false);
            Assert.isNull(implementSegUpdateTargetStandardDataComReqDto.getEvaluationTemplateId(), "B3执行分段更新目标标准数据(管理)-D3执行分段更新目标标准数据(公共)-冗余评价模板ID不能为空", false);
            Assert.isNull(implementSegUpdateTargetStandardDataComReqDto.getSpaceId(), "B3执行分段更新目标标准数据(管理)-D3执行分段更新目标标准数据(公共)-创建于空间ID不能为空", false);
            implementSegUpdateTargetStandardDataComRespDto = fwAppEvaCalcClient.implementSegUpdateTargetStandardDataCom(implementSegUpdateTargetStandardDataComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        }

        BffImplementSegUpdateTargetStandardDataRespDto retData = new BffImplementSegUpdateTargetStandardDataRespDto();


        return retData;
    }

    /**
     * B3开启标志性成果对接[9953]
     * gen by moon at 7/13/2024, 1:13:38 AM
     */
    @Trace(operationName = "B3开启标志性成果对接")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffUpdateAchivementInterfaceRespDto updateAchivementInterface(BffUpdateAchivementInterfaceReqDto reqDto) {


        //步骤0: D3开启标志性成果对接(公共) - updateAchivementInterfaceCom
        UpdateAchivementInterfaceComRespDto updateAchivementInterfaceComRespDto = null;
        UpdateAchivementInterfaceComReqDto updateAchivementInterfaceComReqDto = new UpdateAchivementInterfaceComReqDto();
        if (reqDto != null) {
            updateAchivementInterfaceComReqDto.setIsSymbolicAchievements(reqDto.getIsSymbolicAchievements());//SimpleFieldAssign//sourceId:1927626_1
            updateAchivementInterfaceComReqDto.setObjectiveId(reqDto.getObjectiveId());//SimpleFieldAssign//sourceId:1927624_1
            updateAchivementInterfaceComReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:1927625_1
        }

        /*D3开启标志性成果对接(公共)[9951]   */
        Assert.isNull(updateAchivementInterfaceComReqDto.getIsSymbolicAchievements(), "B3开启标志性成果对接-D3开启标志性成果对接(公共)-是否开启成果对接不能为空", false);
        Assert.isNull(updateAchivementInterfaceComReqDto.getObjectiveId(), "B3开启标志性成果对接-D3开启标志性成果对接(公共)-归属指标ID不能为空", false);
        Assert.isNull(updateAchivementInterfaceComReqDto.getEvaluationTemplateId(), "B3开启标志性成果对接-D3开启标志性成果对接(公共)-冗余评价模板ID不能为空", false);
        updateAchivementInterfaceComRespDto = fwAppEvaCalcClient.updateAchivementInterfaceCom(updateAchivementInterfaceComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        BffUpdateAchivementInterfaceRespDto retData = new BffUpdateAchivementInterfaceRespDto();


        return retData;
    }

    /**
     * B3执行修正总结资料及图片[9957]
     * gen by moon at 7/14/2024, 6:49:16 PM
     */
    @Trace(operationName = "B3执行修正总结资料及图片")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffImplementAdjustedCompilationMaterialsOrPicRespDto implementAdjustedCompilationMaterialsOrPic(BffImplementAdjustedCompilationMaterialsOrPicReqDto reqDto) {


        //步骤0: D3执行修正总结资料及图片(公共) - implementAdjustedCompilationMaterialsOrPicCom
        ImplementAdjustedCompilationMaterialsOrPicComRespDto implementAdjustedCompilationMaterialsOrPicComRespDto = null;
        ImplementAdjustedCompilationMaterialsOrPicComReqDto implementAdjustedCompilationMaterialsOrPicComReqDto = new ImplementAdjustedCompilationMaterialsOrPicComReqDto();
        if (reqDto != null) {
            implementAdjustedCompilationMaterialsOrPicComReqDto.setCycleStageDataId(reqDto.getCycleStageDataId());//SimpleFieldAssign//sourceId:1931539_1
            implementAdjustedCompilationMaterialsOrPicComReqDto.setStaWorSumCon(reqDto.getStaWorSumCon());//SimpleFieldAssign//sourceId:1931540_1
            implementAdjustedCompilationMaterialsOrPicComReqDto.setTextSummaryData(reqDto.getTextSummaryData());//SimpleFieldAssign//sourceId:1931541_1
            implementAdjustedCompilationMaterialsOrPicComReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:1931542_1
        }
        if (reqDto != null && reqDto.getDocumentList() != null && !CollectionUtil.isEmpty(reqDto.getDocumentList())) {
            implementAdjustedCompilationMaterialsOrPicComReqDto.setDocumentList(reqDto.getDocumentList().stream().map(item -> BeanUtil.toBean(item, DocumentDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:1931538_1
        }

        /*D3执行修正总结资料及图片(公共)[9956]   */
        Assert.isNull(implementAdjustedCompilationMaterialsOrPicComReqDto.getCycleStageDataId(), "B3执行修正总结资料及图片-D3执行修正总结资料及图片(公共)-周期阶段资料记录ID不能为空", false);
        Assert.isNull(implementAdjustedCompilationMaterialsOrPicComReqDto.getEvaluationTemplateId(), "B3执行修正总结资料及图片-D3执行修正总结资料及图片(公共)-冗余评价模板ID不能为空", false);
        implementAdjustedCompilationMaterialsOrPicComRespDto = fwAppEvaCalcClient.implementAdjustedCompilationMaterialsOrPicCom(implementAdjustedCompilationMaterialsOrPicComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        BffImplementAdjustedCompilationMaterialsOrPicRespDto retData = new BffImplementAdjustedCompilationMaterialsOrPicRespDto();


        return retData;
    }

    /**
     * B3查询汇报任务树筛选条件列表[9998]
     * gen by moon at 7/24/2024, 3:18:51 AM
     */
    @Trace(operationName = "B3查询汇报任务树筛选条件列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryReportTaskTreeFilterListRespDto queryReportTaskTreeFilterList(BffQueryReportTaskTreeFilterListReqDto reqDto) {


        QueryReportTaskTreeFilterListRespDto queryReportTaskTreeFilterListRespDto_1 = null;
//步骤0: D3查询汇报任务树筛选条件列表 - queryReportTaskTreeFilterList
        QueryReportTaskTreeFilterListRespDto queryReportTaskTreeFilterListRespDto = null;
        QueryReportTaskTreeFilterListReqDto queryReportTaskTreeFilterListReqDto = new QueryReportTaskTreeFilterListReqDto();
        queryReportTaskTreeFilterListReqDto.setIsParentCycle("TRUE");//sourceId:1950006_1
        queryReportTaskTreeFilterListReqDto.setTargetCycleContentTypeCode("TARGET_CATEGORY");//sourceId:1945538_1
        if (reqDto != null) {
            queryReportTaskTreeFilterListReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:1944038_1
        }

        /*D3查询汇报任务树筛选条件列表[9997]   */
        Assert.isNull(queryReportTaskTreeFilterListReqDto.getIsParentCycle(), "B3查询汇报任务树筛选条件列表-D3查询汇报任务树筛选条件列表-是否父周期不能为空", false);
        Assert.isNull(queryReportTaskTreeFilterListReqDto.getTargetCycleContentTypeCode(), "B3查询汇报任务树筛选条件列表-D3查询汇报任务树筛选条件列表-关联目标内容类型编码不能为空", false);
        Assert.isNull(queryReportTaskTreeFilterListReqDto.getEvaluationTemplateId(), "B3查询汇报任务树筛选条件列表-D3查询汇报任务树筛选条件列表-冗余评价模板ID不能为空", false);
        queryReportTaskTreeFilterListRespDto = fwAppEvaCalcClient.queryReportTaskTreeFilterList(queryReportTaskTreeFilterListReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        queryReportTaskTreeFilterListRespDto_1 = queryReportTaskTreeFilterListRespDto;

        BffQueryReportTaskTreeFilterListRespDto retData = new BffQueryReportTaskTreeFilterListRespDto();
        if (queryReportTaskTreeFilterListRespDto_1 != null) {
            retData.setEvaObjTargetCycleList(queryReportTaskTreeFilterListRespDto_1.getEvaObjTargetCycleList().stream().map(item -> BeanUtil.toBean(item, BffEvaObjTargetCycleDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:1944041_1
        }


        List<Object> allNodes = new ArrayList<>();
        allNodes.addAll(retData.getEvaObjTargetCycleList());
        List<TreeNode> nodeList = CommonFunctionHelper.buildTree(allNodes);
        retData.setTreeNode(nodeList);
        retData.setEvaObjTargetCycleList(null);

        return retData;
    }

    /**
     * B3查询汇报任务归属周期筛选条件列表[10002]
     * gen by moon at 7/20/2024, 11:15:59 PM
     */
    @Trace(operationName = "B3查询汇报任务归属周期筛选条件列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryReportTaskAttributionCycleFilterListRespDto queryReportTaskAttributionCycleFilterList(BffQueryReportTaskAttributionCycleFilterListReqDto reqDto) {


        QueryReportTaskAttributionCycleFilterListRespDto queryReportTaskAttributionCycleFilterListRespDto_1 = null;
//步骤0: D3查询汇报任务归属周期筛选条件列表 - queryReportTaskAttributionCycleFilterList
        QueryReportTaskAttributionCycleFilterListRespDto queryReportTaskAttributionCycleFilterListRespDto = null;
        QueryReportTaskAttributionCycleFilterListReqDto queryReportTaskAttributionCycleFilterListReqDto = new QueryReportTaskAttributionCycleFilterListReqDto();
        if (reqDto != null) {
            queryReportTaskAttributionCycleFilterListReqDto.setCycleTypeCode(reqDto.getCycleTypeCode());//SimpleFieldAssign//sourceId:1944503_1
            queryReportTaskAttributionCycleFilterListReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:1944502_1
        }

        /*D3查询汇报任务归属周期筛选条件列表[10000]   */
        Assert.isNull(queryReportTaskAttributionCycleFilterListReqDto.getEvaluationTemplateId(), "B3查询汇报任务归属周期筛选条件列表-D3查询汇报任务归属周期筛选条件列表-冗余评价模板ID不能为空", false);
        queryReportTaskAttributionCycleFilterListRespDto = fwAppEvaCalcClient.queryReportTaskAttributionCycleFilterList(queryReportTaskAttributionCycleFilterListReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        queryReportTaskAttributionCycleFilterListRespDto_1 = queryReportTaskAttributionCycleFilterListRespDto;

        BffQueryReportTaskAttributionCycleFilterListRespDto retData = new BffQueryReportTaskAttributionCycleFilterListRespDto();
        if (queryReportTaskAttributionCycleFilterListRespDto_1 != null) {
            retData.setTargetBelongCycleList(queryReportTaskAttributionCycleFilterListRespDto_1.getTargetBelongCycleList().stream().map(item -> BeanUtil.toBean(item, BffTargetBelongCycleDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:1944507_1
        }


        return retData;
    }

    /**
     * B3查询汇报给我下属筛选条件列表[10003]
     * gen by moon at 7/21/2024, 2:49:20 PM
     */
    @Trace(operationName = "B3查询汇报给我下属筛选条件列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryReportToMeSubordinateFilterListRespDto queryReportToMeSubordinateFilterList(BffQueryReportToMeSubordinateFilterListReqDto reqDto) {


        QueryReportToMeSubordinateFilterListRespDto queryReportToMeSubordinateFilterListRespDto_1 = null;
//步骤0: D3查询汇报给我下属筛选条件列表 - queryReportToMeSubordinateFilterList
        QueryReportToMeSubordinateFilterListRespDto queryReportToMeSubordinateFilterListRespDto = null;
        QueryReportToMeSubordinateFilterListReqDto queryReportToMeSubordinateFilterListReqDto = new QueryReportToMeSubordinateFilterListReqDto();
        if (reqDto != null) {
            queryReportToMeSubordinateFilterListReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:1944566_1
        }

        /*D3查询汇报给我下属筛选条件列表[9999]   */
        Assert.isNull(queryReportToMeSubordinateFilterListReqDto.getEvaluationTemplateId(), "B3查询汇报给我下属筛选条件列表-D3查询汇报给我下属筛选条件列表-冗余评价模板ID不能为空", false);
        queryReportToMeSubordinateFilterListRespDto = fwAppEvaCalcClient.queryReportToMeSubordinateFilterList(queryReportToMeSubordinateFilterListReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        queryReportToMeSubordinateFilterListRespDto_1 = queryReportToMeSubordinateFilterListRespDto;

        BffQueryReportToMeSubordinateFilterListRespDto retData = new BffQueryReportToMeSubordinateFilterListRespDto();
        if (queryReportToMeSubordinateFilterListRespDto_1 != null) {
            retData.setSubordinateChargeSmallCircleList(queryReportToMeSubordinateFilterListRespDto_1.getSubordinateChargeSmallCircleList().stream().map(item -> BeanUtil.toBean(item, BffSubordinateChargeSmallCircleDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:1944569_1
        }


        return retData;
    }

    /**
     * B3查询我相关汇报任务部门筛选条件列表[10005]
     * gen by moon at 7/21/2024, 2:49:32 PM
     */
    @Trace(operationName = "B3查询我相关汇报任务部门筛选条件列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryRelatedMeReportTaskDeptFilterListRespDto queryRelatedMeReportTaskDeptFilterList(BffQueryRelatedMeReportTaskDeptFilterListReqDto reqDto) {


        QueryRelatedMeReportTaskDeptFilterListRespDto queryRelatedMeReportTaskDeptFilterListRespDto_1 = null;
        BatchQueryDeptComRespDto batchQueryDeptComRespDto_1 = null;
//步骤0: D3查询我相关汇报任务部门筛选条件列表 - queryRelatedMeReportTaskDeptFilterList
        QueryRelatedMeReportTaskDeptFilterListRespDto queryRelatedMeReportTaskDeptFilterListRespDto = null;
        QueryRelatedMeReportTaskDeptFilterListReqDto queryRelatedMeReportTaskDeptFilterListReqDto = new QueryRelatedMeReportTaskDeptFilterListReqDto();
        if (reqDto != null) {
            queryRelatedMeReportTaskDeptFilterListReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:1945488_1
        }

        /*D3查询我相关汇报任务部门筛选条件列表[10004]   */
        Assert.isNull(queryRelatedMeReportTaskDeptFilterListReqDto.getEvaluationTemplateId(), "B3查询我相关汇报任务部门筛选条件列表-D3查询我相关汇报任务部门筛选条件列表-冗余评价模板ID不能为空", false);
        queryRelatedMeReportTaskDeptFilterListRespDto = fwAppEvaCalcClient.queryRelatedMeReportTaskDeptFilterList(queryRelatedMeReportTaskDeptFilterListReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        queryRelatedMeReportTaskDeptFilterListRespDto_1 = queryRelatedMeReportTaskDeptFilterListRespDto;

//步骤1: D1批量查询部门(公共) - batchQueryDeptCom
        BatchQueryDeptComRespDto batchQueryDeptComRespDto = null;
        if (queryRelatedMeReportTaskDeptFilterListRespDto != null) {
            BatchQueryDeptComReqDto batchQueryDeptComReqDto = new BatchQueryDeptComReqDto();
            if (queryRelatedMeReportTaskDeptFilterListRespDto != null) {
                batchQueryDeptComReqDto.setDeptList(queryRelatedMeReportTaskDeptFilterListRespDto.getDeptList());//list-field-assign//sourceId:1945490_1
            }

            /*D1批量查询部门(公共)[7511]   */

            batchQueryDeptComRespDto = fwBaseOrgClient.batchQueryDeptCom(batchQueryDeptComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


            batchQueryDeptComRespDto_1 = batchQueryDeptComRespDto;
        }

        BffQueryRelatedMeReportTaskDeptFilterListRespDto retData = new BffQueryRelatedMeReportTaskDeptFilterListRespDto();
        //数据集融合  MoreListToOneSource
        if (queryRelatedMeReportTaskDeptFilterListRespDto_1 != null && !CollectionUtil.isEmpty(queryRelatedMeReportTaskDeptFilterListRespDto_1.getDeptList())) {
            for (String string : queryRelatedMeReportTaskDeptFilterListRespDto_1.getDeptList()) {
                BffDeptListDto retElm = new BffDeptListDto();
                if (queryRelatedMeReportTaskDeptFilterListRespDto_1 != null) {
                    retElm.setDeptId(string);//SimpleFieldAssign//sourceId:397432_2
                }
                retData.getDeptList().add(retElm);
                if (batchQueryDeptComRespDto_1 != null) {
                    for (DeptDto deptDto : batchQueryDeptComRespDto_1.getDeptList()) {
                        if (deptDto.getDeptId().equals(string)) {
                            if (batchQueryDeptComRespDto_1 != null) {
                                retElm.setDeptShortName(deptDto.getDeptShortName());//SimpleFieldAssign//sourceId:397433_2
                            }
                        }
                    }
                }

            }
        }//sourceId:1945494_1


        return retData;
    }

    /**
     * B3查询未完成汇报任务列表[10143]
     * gen by moon at 8/22/2024, 12:29:54 AM
     */
    @Trace(operationName = "B3查询未完成汇报任务列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryIncompleteReportTaskListRespDto queryIncompleteReportTaskList(BffQueryIncompleteReportTaskListReqDto reqDto) {


        QueryIncompleteReportTaskListRespDto queryIncompleteReportTaskListRespDto_1 = null;
//步骤0: D3查询未完成汇报任务列表 - queryIncompleteReportTaskList
        QueryIncompleteReportTaskListRespDto queryIncompleteReportTaskListRespDto = null;
        QueryIncompleteReportTaskListReqDto queryIncompleteReportTaskListReqDto = new QueryIncompleteReportTaskListReqDto();
        if (reqDto != null) {
            queryIncompleteReportTaskListReqDto.setCycleId(reqDto.getCycleId());//SimpleFieldAssign//sourceId:1982312_1
            queryIncompleteReportTaskListReqDto.setTableTypeCode(reqDto.getTableTypeCode());//SimpleFieldAssign//sourceId:1982313_1
            queryIncompleteReportTaskListReqDto.setIsLast(reqDto.getIsLast());//SimpleFieldAssign//sourceId:1982314_1
            queryIncompleteReportTaskListReqDto.setLevelNumber(reqDto.getLevelNumber());//SimpleFieldAssign//sourceId:1982315_1
            queryIncompleteReportTaskListReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:1982316_1
        }

        /*D3查询未完成汇报任务列表[10144]   */

        queryIncompleteReportTaskListRespDto = fwAppEvaCalcClient.queryIncompleteReportTaskList(queryIncompleteReportTaskListReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        queryIncompleteReportTaskListRespDto_1 = queryIncompleteReportTaskListRespDto;

        BffQueryIncompleteReportTaskListRespDto retData = new BffQueryIncompleteReportTaskListRespDto();
        if (queryIncompleteReportTaskListRespDto_1 != null) {
            retData.setTaskDataList(queryIncompleteReportTaskListRespDto_1.getTaskDataList().stream().map(item -> BeanUtil.toBean(item, BffTaskDataDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:1982323_1
        }


        retData.setPageNum(queryIncompleteReportTaskListRespDto.getPageNum());
        retData.setPageSize(queryIncompleteReportTaskListRespDto.getPageSize());
        retData.setTotal(queryIncompleteReportTaskListRespDto.getTotalNum());
        retData.setIsLastPage((Math.ceil(Double.valueOf(queryIncompleteReportTaskListRespDto.getTotalNum()) / Double.valueOf(queryIncompleteReportTaskListRespDto.getPageSize()))) <= retData.getPageNum());


        return retData;
    }

    /**
     * B3查询目标内容最新数据点列表[10158]
     * gen by moon at 9/12/2024, 3:27:44 PM
     */
    @Trace(operationName = "B3查询目标内容最新数据点列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryTargetContNewestDatasListRespDto queryTargetContNewestDatasList(BffQueryTargetContNewestDatasListReqDto reqDto) {


        QueryTargetContNewestDatasListRespDto queryTargetContNewestDatasListRespDto_1 = null;
//步骤0: D3查询目标内容最新数据点列表 - queryTargetContNewestDatasList
        QueryTargetContNewestDatasListRespDto queryTargetContNewestDatasListRespDto = null;
        QueryTargetContNewestDatasListReqDto queryTargetContNewestDatasListReqDto = new QueryTargetContNewestDatasListReqDto();
        queryTargetContNewestDatasListReqDto.setEvaObjEntityId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:1983883_1
        queryTargetContNewestDatasListReqDto.setEvaObjTypeCode("EVA_OBJECT");//sourceId:1983884_1
        queryTargetContNewestDatasListReqDto.setIsSubCycle("TRUE");//sourceId:1983909_1
        queryTargetContNewestDatasListReqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:1983889_1
        if (reqDto != null) {
            queryTargetContNewestDatasListReqDto.setTableTypeCode(reqDto.getTableTypeCode());//SimpleFieldAssign//sourceId:1983885_1
            queryTargetContNewestDatasListReqDto.setIsLast(reqDto.getIsLast());//SimpleFieldAssign//sourceId:1983886_1
            queryTargetContNewestDatasListReqDto.setLevelNumber(reqDto.getLevelNumber());//SimpleFieldAssign//sourceId:1983887_1
            queryTargetContNewestDatasListReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:1983888_1
        }

        /*D3查询目标内容最新数据点列表[10157]   */
        Assert.isNull(queryTargetContNewestDatasListReqDto.getEvaObjEntityId(), "B3查询目标内容最新数据点列表-D3查询目标内容最新数据点列表-被评对象内容表主键ID不能为空", false);
        Assert.isNull(queryTargetContNewestDatasListReqDto.getEvaObjTypeCode(), "B3查询目标内容最新数据点列表-D3查询目标内容最新数据点列表-被评对象类型编码不能为空", false);
        Assert.isNull(queryTargetContNewestDatasListReqDto.getIsSubCycle(), "B3查询目标内容最新数据点列表-D3查询目标内容最新数据点列表-是否子周期不能为空", false);
        Assert.isNull(queryTargetContNewestDatasListReqDto.getSpaceId(), "B3查询目标内容最新数据点列表-D3查询目标内容最新数据点列表-创建于空间ID不能为空", false);
        queryTargetContNewestDatasListRespDto = fwAppEvaCalcClient.queryTargetContNewestDatasList(queryTargetContNewestDatasListReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        queryTargetContNewestDatasListRespDto_1 = queryTargetContNewestDatasListRespDto;

        BffQueryTargetContNewestDatasListRespDto retData = new BffQueryTargetContNewestDatasListRespDto();
        if (queryTargetContNewestDatasListRespDto_1 != null) {
            retData.setEvaObjTargetCycleList(queryTargetContNewestDatasListRespDto_1.getEvaObjTargetCycleList().stream().map(item -> BeanUtil.toBean(item, BffEvaObjTargetCycleDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:1983895_1
        }


        retData.setPageNum(queryTargetContNewestDatasListRespDto.getPageNum());
        retData.setPageSize(queryTargetContNewestDatasListRespDto.getPageSize());
        retData.setTotal(queryTargetContNewestDatasListRespDto.getTotalNum());
        retData.setIsLastPage((Math.ceil(Double.valueOf(queryTargetContNewestDatasListRespDto.getTotalNum()) / Double.valueOf(queryTargetContNewestDatasListRespDto.getPageSize()))) <= retData.getPageNum());


        return retData;
    }

    /**
     * B3查询汇报任务周期筛选列表[10218]
     * gen by moon at 9/12/2024, 7:28:40 PM
     */
    @Trace(operationName = "B3查询汇报任务周期筛选列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryReportTaskCycleFilterListRespDto queryReportTaskCycleFilterList(BffQueryReportTaskCycleFilterListReqDto reqDto) {


        QueryReportTaskCycleFilterListRespDto queryReportTaskCycleFilterListRespDto_1 = null;
//步骤0: D3查询汇报任务周期筛选列表 - queryReportTaskCycleFilterList
        QueryReportTaskCycleFilterListRespDto queryReportTaskCycleFilterListRespDto = null;
        QueryReportTaskCycleFilterListReqDto queryReportTaskCycleFilterListReqDto = new QueryReportTaskCycleFilterListReqDto();
        if (reqDto != null) {
            queryReportTaskCycleFilterListReqDto.setIsProcessCycleStage(reqDto.getIsProcessCycleStage());//SimpleFieldAssign//sourceId:1999167_1
            queryReportTaskCycleFilterListReqDto.setIsSubCycle(reqDto.getIsSubCycle());//SimpleFieldAssign//sourceId:1999168_1
            queryReportTaskCycleFilterListReqDto.setCycleId(reqDto.getCycleId());//SimpleFieldAssign//sourceId:1999636_1
            queryReportTaskCycleFilterListReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:1999169_1
        }

        /*D3查询汇报任务周期筛选列表[10217]   */
        Assert.isNull(queryReportTaskCycleFilterListReqDto.getIsProcessCycleStage(), "B3查询汇报任务周期筛选列表-D3查询汇报任务周期筛选列表-是否过程周期阶段不能为空", false);
        Assert.isNull(queryReportTaskCycleFilterListReqDto.getEvaluationTemplateId(), "B3查询汇报任务周期筛选列表-D3查询汇报任务周期筛选列表-冗余评价模板ID不能为空", false);
        queryReportTaskCycleFilterListRespDto = fwAppEvaCalcClient.queryReportTaskCycleFilterList(queryReportTaskCycleFilterListReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        queryReportTaskCycleFilterListRespDto_1 = queryReportTaskCycleFilterListRespDto;

        BffQueryReportTaskCycleFilterListRespDto retData = new BffQueryReportTaskCycleFilterListRespDto();
        if (queryReportTaskCycleFilterListRespDto_1 != null) {
            retData.setReportTaskCycleFilterList(queryReportTaskCycleFilterListRespDto_1.getReportTaskCycleFilterList().stream().map(item -> BeanUtil.toBean(item, BffReportTaskCycleFilterDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:1999174_1
        }


        return retData;
    }

    /**
     * B3查询目标内容周期导航列表(边界)[10243]
     * gen by moon at 9/26/2024, 8:49:36 PM
     */
    @Trace(operationName = "B3查询目标内容周期导航列表(边界)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffQueryTargetContCyclePhaseMenuListBorderRespDto queryTargetContCyclePhaseMenuListBorder(BffQueryTargetContCyclePhaseMenuListBorderReqDto reqDto) {


        QueryTargetContCyclePhaseMenuListRespDto queryTargetContCyclePhaseMenuListRespDto_1 = null;
//步骤0: D3查询目标内容周期导航列表 - queryTargetContCyclePhaseMenuList
        QueryTargetContCyclePhaseMenuListRespDto queryTargetContCyclePhaseMenuListRespDto = null;
        QueryTargetContCyclePhaseMenuListReqDto queryTargetContCyclePhaseMenuListReqDto = new QueryTargetContCyclePhaseMenuListReqDto();
        queryTargetContCyclePhaseMenuListReqDto.setEvaObjEntityId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:2011046_1
        queryTargetContCyclePhaseMenuListReqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:2011047_1
        if (reqDto != null) {
            queryTargetContCyclePhaseMenuListReqDto.setCycleId(reqDto.getCycleId());//SimpleFieldAssign//sourceId:2011040_1
            queryTargetContCyclePhaseMenuListReqDto.setIsParentCycle(reqDto.getIsParentCycle());//SimpleFieldAssign//sourceId:2011041_1
            queryTargetContCyclePhaseMenuListReqDto.setIsMetaphase(reqDto.getIsMetaphase());//SimpleFieldAssign//sourceId:2011042_1
            queryTargetContCyclePhaseMenuListReqDto.setIsSubCycle(reqDto.getIsSubCycle());//SimpleFieldAssign//sourceId:2011043_1
            queryTargetContCyclePhaseMenuListReqDto.setWorkCycleIsSame(reqDto.getWorkCycleIsSame());//SimpleFieldAssign//sourceId:2011044_1
            queryTargetContCyclePhaseMenuListReqDto.setBelongToContentId(reqDto.getRelateContentId());//SimpleFieldAssign//sourceId:2011045_1
        }

        /*D3查询目标内容周期导航列表[10242]   */
        Assert.isNull(queryTargetContCyclePhaseMenuListReqDto.getCycleId(), "B3查询目标内容周期导航列表(边界)-D3查询目标内容周期导航列表-归属周期ID不能为空", false);
        Assert.isNull(queryTargetContCyclePhaseMenuListReqDto.getBelongToContentId(), "B3查询目标内容周期导航列表(边界)-D3查询目标内容周期导航列表-数据归属内容表主键ID不能为空", false);
        Assert.isNull(queryTargetContCyclePhaseMenuListReqDto.getEvaObjEntityId(), "B3查询目标内容周期导航列表(边界)-D3查询目标内容周期导航列表-主树被评对象内容表主键ID不能为空", false);
        Assert.isNull(queryTargetContCyclePhaseMenuListReqDto.getSpaceId(), "B3查询目标内容周期导航列表(边界)-D3查询目标内容周期导航列表-创建于空间ID不能为空", false);
        queryTargetContCyclePhaseMenuListRespDto = fwAppEvaCalcClient.queryTargetContCyclePhaseMenuList(queryTargetContCyclePhaseMenuListReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        queryTargetContCyclePhaseMenuListRespDto_1 = queryTargetContCyclePhaseMenuListRespDto;

        BffQueryTargetContCyclePhaseMenuListBorderRespDto retData = new BffQueryTargetContCyclePhaseMenuListBorderRespDto();
        if (queryTargetContCyclePhaseMenuListRespDto_1 != null) {
            retData.setCycleId(queryTargetContCyclePhaseMenuListRespDto_1.getCycleId());//SimpleFieldAssign//sourceId:2011063_1
            retData.setCycleStandardName(queryTargetContCyclePhaseMenuListRespDto_1.getCycleStandardName());//SimpleFieldAssign//sourceId:2011064_1
            retData.setCycleStartTime(queryTargetContCyclePhaseMenuListRespDto_1.getCycleStartTime());//SimpleFieldAssign//sourceId:2011065_1
            retData.setCycleEndTime(queryTargetContCyclePhaseMenuListRespDto_1.getCycleEndTime());//SimpleFieldAssign//sourceId:2011066_1
            retData.setIsParentCycle(queryTargetContCyclePhaseMenuListRespDto_1.getIsParentCycle());//SimpleFieldAssign//sourceId:2011067_1
            retData.setIsMetaphase(queryTargetContCyclePhaseMenuListRespDto_1.getIsMetaphase());//SimpleFieldAssign//sourceId:2011068_1
            retData.setIsSubCycle(queryTargetContCyclePhaseMenuListRespDto_1.getIsSubCycle());//SimpleFieldAssign//sourceId:2011069_1
            retData.setExecuteCycleStageList(queryTargetContCyclePhaseMenuListRespDto_1.getExecuteCycleStageList().stream().map(item -> BeanUtil.toBean(item, BffExecuteCycleStageDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:2011260_1
        }


        return retData;
    }
    //
}
